<template>
    <div class="line">
        <div class="top">
            <p class="title">未来7天游客数量趋势图</p>
            <p class="bg"></p>
        </div>
        <div ref="chartRef" class="chart"></div>
    </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts';
import { ref , onMounted } from 'vue';

const chartRef = ref(null);

onMounted(() => {
    let myChart = echarts.init(chartRef.value);
    myChart.setOption({
        title: {
            text: '未来7天游客数量趋势图',
            textStyle: {
                color: '#fff',
                fontSize: 16
            },
            left: 'center'
        },
        grid: {
            top: 30,
            bottom: 40
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['游客数量'],
            textStyle: {
                color: '#fff'
            },
            left: 'center'
        },
        xAxis: {
            type: 'category',
            data: ['04/25', '04/26', '04/27', '04/28', '04/29', '04/30','05/01','05/02','05/03','05/04','05/05','05/06','05/07','05/08','05/09'],
            boundaryGap: false,
            splitLine: {
                show: false
            },
            axisLine : {
                show: false
            }

        },
        yAxis: {
            type: 'value',
            splitLine: {
                show: false
            },
            axisLine : {
                show: false
            }

        },
        series: [{
            data: [120, 270, 150, 180, 350, 60, 230,345,344,45,166,47,8,296,540,543],
            type: 'line',
            smooth: true,
            areaStyle: {
                color:{
                    type: 'linear',
                    x: 0,
                    y: 0,
                    x2: 0,
                    y2: 1,
                    colorStops: [{
                        offset: 0, color: '#00ffFF' // 0% 处的颜色
                    }, {
                        offset: 1, color: 'blue' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                    }
            }
        }]
    });
})

</script>

<style scoped lang="scss">
.line {
    width: 100%;
    height: 100%;
    background: url(../images/dataScreen-main-lb.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;

    .top {
        margin-left: 60px;
        .title {
            color: #fff;
            font-size: 20px;
        }
        .bg {
            background: url(../images/dataScreen-title.png) no-repeat;
            background-size: 100% 100%;
            width: 68px;
            height: 7px;
            margin-top: 10px;
        }
    }
    .chart {
        height: calc(100% - 40px);
    }
    
}
</style>